import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import './assets/style/common.scss';
import "virtual:svg-icons-register"

// 导入全局组件注册
import { setupGlobalComponents } from '@/plugins/globalComponents'

// @ts-expect-error: 忽略类型声明缺失
import zhCn from 'element-plus/dist/locale/zh-cn.js';

// 导入mock数据，开发环境使用
import './mock';

// 创建Vue应用
const app = createApp(App);

// 注册全局组件
setupGlobalComponents(app);

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 使用插件
app.use(router);
app.use(store);
app.use(ElementPlus, {
  size: 'default',
  locale: zhCn
});

// 挂载应用
app.mount('#app');
